package site.hanzhe.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import site.hanzhe.dao.AuthDao;
import site.hanzhe.entity.AuthEntity;
import site.hanzhe.service.AuthService;

import java.util.List;

@Service
public class AuthServiceImpl implements AuthService {

    @Autowired
    private AuthDao authDao;

    @Override
    public List<AuthEntity> selectList() {
        return authDao.selectList(null);
    }

    @Override
    public List<Integer> selectAssignAuthIdByRoleId(Integer roleId) {
        return authDao.selectAssignAuthIdByRoleId(roleId);
    }

    @Override
    public List<AuthEntity> selectAssignAuthByAdminId(Integer adminId) {
        return authDao.selectAssignAuthByAdminId(adminId);
    }


    @Override
    public int deleteAssignAuthByRoleId(String id) {
        return authDao.deleteAssignAuthByRoleId(id);
    }

    @Override
    public int insertAssignAuthByRoleId(String id, List<String> list) {
        return ( list.size() > 0 ) ? authDao.insertAssignAuthByRoleId(id, list) : 0;
    }
}
